package com.factory.ssm.listener;


import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;



/**
 * 服务器启动监听器
 * @author 18801
 *
 */
public class ServerStartupListener implements ServletContextListener {

	public void contextInitialized(ServletContextEvent sce) {
		
		// 获取web应用对象
		ServletContext application = sce.getServletContext();
		
		// 获取当前的上下文路径
		String path = application.getContextPath();
		System.out.println(path);
		
		// 保存路径到web应用范围中，让所有的用户访问
		application.setAttribute("APP_PATH", path);
		}
		


	public void contextDestroyed(ServletContextEvent sce) {
		// TODO Auto-generated method stub

	}

}
